from peewee import *

database = SqliteDatabase('bangzhu')

class UnknownField(object):
    def __init__(self, *_, **__): pass

class BaseModel(Model):
    class Meta:
        database = database

class TActivity(BaseModel):
    activityid = TextField(primary_key=True)
    address = TextField(null=True)
    begintime = TextField(null=True)
    content = TextField(null=True)
    createat = TextField(null=True)
    endtime = TextField(null=True)
    isdel = IntegerField(null=True)
    maxmembernum = IntegerField(null=True)
    owner = TextField(null=True)
    tags = TextField(null=True)
    title = TextField(null=True)
    updateat = TextField(null=True)

    class Meta:
        table_name = 't_activity'

class TCate(BaseModel):
    cid = TextField(primary_key=True)
    createat = TextField(null=True)
    name = TextField(null=True)
    thumb = TextField(null=True)
    updateat = TextField(null=True)

    class Meta:
        table_name = 't_cate'

class TOrder(BaseModel):
    createat = TextField(null=True)
    goodsid = TextField(null=True)
    oid = TextField(primary_key=True)
    price = TextField(null=True)
    status = IntegerField(null=True)
    uid = TextField(null=True)
    updateat = TextField(null=True)

    class Meta:
        table_name = 't_order'

class TPost(BaseModel):
    cid = TextField(null=True)
    content = TextField(null=True)
    createat = TextField(null=True)
    images = TextField(null=True)
    pid = TextField(primary_key=True)
    price = TextField(null=True)
    status = IntegerField(null=True)
    title = TextField(null=True)
    uid = TextField(null=True)
    updateat = TextField(null=True)

    class Meta:
        table_name = 't_post'

class TUser(BaseModel):
    address = TextField(null=True)
    avatar = TextField(null=True)
    city = TextField(null=True)
    createat = TextField(null=True)
    level = IntegerField(null=True)
    nickname = TextField(null=True)
    phone = TextField(null=True)
    uid = TextField(primary_key=True)
    uname = TextField(null=True)
    upasswd = TextField(null=True)
    updateat = TextField(null=True)

    class Meta:
        table_name = 't_user'

